package com.xk857.article.controller.pub;


import com.xk857.article.service.ICommentService;
import com.xk857.entities.Comment;
import com.xk857.util.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 评论信息表 前端控制器
 *
 * @author CV大魔王
 * @since 2021-02-21
 */
@Api(value = "评论管理接口(公共)",tags = "评论管理接口(公共)")
@RestController
@RequestMapping("/pub/comment")
public class PubCommentController {

    @Autowired
    private ICommentService commentService;

    @ApiOperation("通过文章ID递归查询所有评论")
    @ApiImplicitParam(name="articleId", value="文章ID", required=true)
    @GetMapping("/list/{articleId}")
    public List<Comment> findByArticleId(@PathVariable("articleId") String articleId) {
        return commentService.findByArticleId(articleId);
    }


}
